#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#include<string.h>

#define BUFFSIZE 1024
int main(int argc,char **argv)
{
		int tmp;
		char buff[BUFFSIZE];
		int count=0,lines=0;
		FILE *fps,*fpd;
		fps=fopen(argv[1],"rb");
		if(fps==NULL)
		{
				perror("open failde");
				return -1;
		}
		fpd=fopen(argv[2],"wb");
		if(fpd==NULL)
		{
				perror("file failed");
				return -1;
		}
    
		while(fgets(buff,BUFFSIZE,fps))
		{
			count += strlen(buff);
			fputs(buff,fpd);
			lines++;
		}
		
		printf("复制文件的字符数=%d\n",count);
		printf("复制文件的行数=%d\n",lines);
		fclose(fps);
		fclose(fpd);
    return 0;
}
